#pragma once

#include "IStream.h"

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/vector.hpp>

class CByteStream : public IStream
{
public:
	CByteStream(void);
	CByteStream(const CByteStream& other);

	CByteStream& operator= (const CByteStream& other);

	std::string getBufferContent() const;
	void addBack(const std::string& data);
	void addFront(const std::string& data);
	void addAt(const std::string& data, int offset);
	void removeElements(int offset, int count);

	friend class boost::serialization::access;
	
	template<class Archive> 
	void serialize(Archive & ar, const unsigned int version) 
	{
		ar & boost::serialization::base_object<IStream>(*this);
		ar & m_VecBuffer;
	}

private:
	std::vector<char> m_VecBuffer;
};
